#!/bin/bash

# 瞬变源分类服务Docker镜像构建脚本

echo "正在构建瞬变源分类服务Docker镜像..."

# 检查Docker是否正在运行
if ! docker info >/dev/null 2>&1; then
    echo "错误: Docker守护进程未运行，请先启动Docker Desktop应用程序"
    exit 1
fi

# 构建镜像
docker build -t transient-classify .

if [ $? -eq 0 ]; then
    echo "Docker镜像构建成功！"
    echo ""
    echo "使用以下命令运行容器："
    echo "docker run -d -p 5001:5001 \\"
    echo "  -v ./data/datasets:/app/data/datasets \\"
    echo "  -v ./ot_classify_service/data:/app/ot_classify_service/data \\"
    echo "  --name transient-classify-service \\"
    echo "  transient-classify"
    echo ""
    echo "或者使用docker-compose："
    echo "docker-compose up -d"
else
    echo "Docker镜像构建失败，请检查错误信息"
    exit 1
fi